<include file="Public/header" title="发票详情"/>
<include file="Public/header_bak" />
    <article class="invoice">
        <div class="invoice-head flex-justify">
            <h3>发票信息</h3>
            <span>订单号: {$data.order_sn}</span>
        </div>
        <div class="invoice-main">
            <section class="invoice-list flex-justify">
                <span>发票种类</span>
                <span>{:$data['inv_online'] == '1'?'电子发票':'纸质发票'}</span>
            </section>
            <section class="invoice-list flex-justify">
                <span>发票类型</span>
                <span>{$data.inv_type}</span>
            </section>
            <section class="invoice-list flex-justify">
                <span>发票内容</span>
                <span>{$data.inv_content}</span>
            </section>
            <section class="invoice-list flex-justify">
                <span>以往开发票</span>
                <span>无</span>
            </section>
            <section class="invoice-list flex-justify">
                <span>单位名称</span>
                <span>{$data.inv_payee}</span>
            </section>
            <section class="invoice-list flex-justify">
                <span>纳税人识别号</span>
                <span>{$data.inv_num}</span>
            </section>
            <section class="invoice-list flex-justify">
                <span>开户银行</span>
                <span>{$data.inv_bank}</span>
            </section>
            <section class="invoice-list flex-justify">
                <span>银行账户</span>
                <span>{$data.inv_account}</span>
            </section>
            <section class="invoice-list flex-justify">
                <span>注册电话</span>
                <span>{$data.inv_phone}</span>
            </section>
            <section class="invoice-list">
                <span>注册地址</span>
                <p>{$data.inv_addr}</p>
            </section>
            <section id="refundReason" style="display:none;" class="invoice-list refund-ticket">
                <h4>退票原因</h4>
                <form id="dataForm">
                <input type="hidden" name="refund_status" value="1"/>
                <input type="hidden" name="order_id" value="{$data.order_id}"/>
                <textarea placeholder="请输入退票原因" name="refund_reason">{$data.refund_reason}</textarea>
                </form>
            </section>
            <if condition="$data.refund_status eq '1'">
	            <section class="invoice-list">
	                <span>退票原因</span>
	                <p>{$data.refund_reason}</p>
	            </section>
            </if>
        </div>
    </article>
    <if condition="$data.inv_online neq '1'">
	    <div class="contact-padding">
	        <div class="contact"><i class="iconfont icon-gantanhao"></i>如需退票，请联系客服400-820-8688完成相关退票事宜
	        </div>
	    </div>
    <else/>
	    <div name="refundMsg" class="contact">
	        <i class="iconfont icon-gantanhao"></i>
	        如需下载电子发票，请至pc端网站下载
	    </div>
	    <if condition="$data.refund_reason eq ''">
		    <div name="refundMsg" class="refund">
		        <a href="javascript:void(0)" onclick="applyRefund()">申请退票</a>
		    </div>
		    <div id="saveBtn" style="display:none;" class="refund">
		        <a href="javascript:void(0)" onclick="saveApply()">提交申请</a>
		    </div>
	    </if>
    </if>
<script>
function applyRefund(){
	$('*[name=refundMsg]').hide();
	$('#saveBtn,#refundReason').show();
}
function saveApply(){
	$.post(
		"{:U('refundInv')}",
		$('#dataForm').serializeArray(),
		function(data){
			if(data.status == '1'){
				layer.msg(data.info)
				setTimeout("location.href='"+document.referrer+"'",1000);
			}else{
				layer.msg(data.info)
			}
		}
	)
}
</script>
<include file="Public/footer"/>


